/*
 * Copyright (C) 2010, JDevelopers (jdevelopers@my-pages.org) 
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * 
 *    http://www.apache.org/licenses/LICENSE-2.0 
 * 
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and 
 * limitations under the License. 
 */
/**
 * Test
 */
package org.jdevelopers.xarf;

import java.util.EnumSet;

/**
 * Enum, which defines the possible format types for the properties in a x-arf schema.
 * 
 * @author Marcel Hartwig
 * @version 0.1
 * @since JXarfValidator 0.1
 */
public enum EXarfPropertyFormatType {
	
	/**
	 * The type of the data is an email address.
	 */
	EMAIL("email"),
	
	/**
	 * Type of data is a date in the RFC822 format.
	 */
	DATE_TIME("date-time"),
	
	/**
	 * The type of the data is a URI.
	 */
	URI("uri"),
	
	/**
	 * The type of the data is not specified, so everything is a valid value.
	 */
	NOT_SPECIFIED("not-specified");
	
	private final String type;
	
	/**
	 * Constructor for the EXarfPropertyFormatType.
	 * 
	 * @param type name for the EXarfPropertyFormatType.
	 */
	EXarfPropertyFormatType(String type) {
		this.type = type;
	}
	
	/**
	 * Returns the name for EXarfPropertyFormatType.
	 * 
	 * @return the name for EXarfPropertyFormatType.
	 */
	public String getType() {
		return type;
	}
	
	/**
	 * Provides the String representation of the <code>EXarfPropertyFormatType</code>.
	 */
	@Override
	public String toString() {
		return type;
	}
	
	/**
	 * Returns the associated EXarfPropertyFormatType from the given name. If the name does not match a 
	 * possible value, NOT_SPECIFIED will be returned.
	 * 
	 * @param enumName the name for EXarfReportAttachmentType you want to get.
	 * @return the associated EXarfPropertyFormatType.
	 */
	public static EXarfPropertyFormatType getByValue(String enumName){
		for (final EXarfPropertyFormatType element : EnumSet.allOf(EXarfPropertyFormatType.class)) {
            if (element.toString().equals(enumName)) {
                return element;
            }
        }
        return NOT_SPECIFIED;
    }

	
	
}
